<?php echo 1;
require_once('class.receiver.php');
require_once($GLOBALS['LNG'] . $_SESSION[$SESSLG] . '/lang.default.mex');
if (!isset($_POST['BnfViewMode'])) {
    $_POST['BnfViewMode'] = 0;
}
form_pr('ReceiverProperties', '', '', 'post');
mn_field('hidden', 'ED', 'BnfViewMode', $_POST['BnfViewMode'], '', '', '', '');
mn_field('hidden', 'ED', 'AccViewMode', 0, '', '', '', '');
$MDRC = 'RD';
if (!isset($_POST['ORP'])) {
    $_POST['ORP'] = 1;
}
if (!isset($_POST['RCTP'])) {
    $_POST['RCTP'] = 0;
}
mn_field('hidden', 'ED', 'ORP', 1, '', '', '', '');
if (!isset($OBJCTCL)) {
    if (isset($_POST['CID'])) {
        $OBJCTCL = $_POST['CID'];
    } elseif (isset($_GET['CID'])) {
        $OBJCTCL = $_GET['CID'];
    }
}
if (!isset($CLST)) {
    if (isset($_POST['CST'])) {
        $CLST = $_POST['CST'];
    } elseif (isset($_GET['CST'])) {
        $CLST = $_GET['CST'];
    }
}
if (isset($_POST['RID']) && $_POST['RID'] > 0) {
    $OBJCTRC = $_POST['RID'];
} elseif (isset($_GET['RID'])) {
    $OBJCTRC = $_GET['RID'];
} else {
    $_POST['RID'] = '';
    $OBJCTRC = 0;
}
mn_field('hidden', 'ED', 'CID', $OBJCTCL, '', '', '', '');
mn_field('hidden', 'ED', 'CST', $CLST, '', '', '', '');
mn_field('hidden', 'ED', 'RID', $_POST['RID'], '', '', '', '');
mn_field('hidden', 'ED', 'AID', '', '', '', '', '');

if (!isset($_POST['rcvGood'])) {
    $_POST['rcvGood'] = '';
}
if (!isset($_POST['rcvGroup'])) {
    $_POST['rcvGroup'] = '';
}
if (!isset($_POST['rcvCode'])) {
    $_POST['rcvCode'] = '';
}
if (!isset($_POST['rcvIdentifier'])) {
    $_POST['rcvIdentifier'] = '';
}
?>
<div id="RC">
    <div id="NWRC"></div>
    <?php
    mn_field('hselect', 'ED', 'RCTP', $_POST['RCTP'], "Beneficiarios Pessoais;Pagamentos de Servicos;Compras#0;1;2", '38', '', '"
                onChange="document.ReceiverProperties.RID.value=\'\';
                document.ReceiverProperties.action=\'_response/call.php?get=Operative/receiver\';
                subform(\'ReceiverProperties\',\'ClientProp\');');
    if ($_POST['RCTP'] == 0) {
        if (isset($OBJCTRC)) {
            mn_field('button', 'ED', 'FMRC', 'Escolher outro Beneficiario', '100', '38', 'False', 'SUBMIT"
                onClick="document.ReceiverProperties.RID.value=\'\';
                document.ReceiverProperties.action=\'_response/call.php?get=Operative/receiver\';
                subform(\'ReceiverProperties\',\'ClientProp\');');
        }
        mn_field('button', 'ED', 'FMRC', 'Novo Beneficiario', '100', '38', '', 'SUBMIT" onClick="
                document.ReceiverProperties.RID.value=\'\';
                if(typeof(document.ReceiverProperties.AC)!=\'undefined\'){document.ReceiverProperties.AC.innerHTML=\'\';}
                if(typeof(document.ReceiverProperties.OrderProp)!=\'undefined\'){document.ReceiverProperties.OrderProp.innerHTML=\'\';}
                document.ReceiverProperties.action=\'_response/call.php?get=Operative/view/viewreceiver\';
                subform(\'ReceiverProperties\',\'NWRC\');');
        if ($_POST['BnfViewMode'] == 1) {
            mn_field('button', 'ED', 'ALRC', 'Esconder Bloqueados', '100', '38', '', 'SUBMIT"
                onClick="document.ReceiverProperties.BnfViewMode.value=\'0\';
                document.ReceiverProperties.action=\'_response/call.php?get=Operative/receiver\';
                subform(\'ReceiverProperties\',\'ClientProp\');');
        } else {
            mn_field('button', 'ED', 'ALRC', 'Ver Bloqueados', '100', '38', '', 'SUBMIT"
                onClick="document.ReceiverProperties.BnfViewMode.value=\'1\';
                document.ReceiverProperties.action=\'_response/call.php?get=Operative/receiver\';
                subform(\'ReceiverProperties\',\'ClientProp\');');
        }
    } ?>
    <div id="ReceiverInfo">
        <?php
        if (!isset($_POST['RCTP']) || $_POST['RCTP'] == 0) {
            
        } elseif ($_POST['RCTP'] == 1) {
            echo '<table  class="gridtable"><tr>
		<td>CÓdigo do Bem:</td><td>' . rt_field('text', 'ED', 'rcvGood', $_POST['rcvGood'], '', '', '', '') . '</td>
                <td>N. do Grupo:</td><td>' . rt_field('text', 'ED', 'rcvGroup', $_POST['rcvGroup'], '', '', '', '') . '</td>
                <td>Cota:</td><td>' . rt_field('text', 'ED', 'rcvCode', $_POST['rcvCode'], '', '', '', '') . '</td>
                <td></td>
           </tr>
        </table>';
        } elseif ($_POST['RCTP'] == 2) {
            echo '<table  class="gridtable"><tr><td>N. Factura:</td>
                    <td>' . rt_field('text', 'ED', 'rcvIdentifier', $_POST['rcvIdentifier'], '', '', '', '') . '</td>
                    <td>' . rt_field('button', 'ED', 'rcvSave', 'Validar', '', '', '', '" onClick="
		if(document.getElementById(\'rcvIdentifier\').value ==\'\') {
			alert(\'Os dados da transaccao nao se encontram correctamente preenchidos.\');
		} else {
			document.ReceiverProperties.RID.value=\'\';
			document.ReceiverProperties.action=\'_response/call.php?get=Operative/receiver\';
			subform(\'ReceiverProperties\',\'ClientProp\');
		}') . '</td>
              </tr></table>';
        }
        ?>
    </div>
    <table width="100%" border="0" cellpadding="1" cellspacing="1">
        <tr style="height:16px;text-align:center" bgcolor="#BACCD1">
            <td></td>
            <td width="5%"><?php echo $lang['basic']['number']; ?></td>
            <td width="40%" bgcolor="#BACCD1"><?php echo $lang['basic']['name']; ?></td>
            <td width="10%"><?php echo $lang['basic']['document']; ?></td>
            <td width="10%"><?php echo $lang['basic']['country']; ?></td>
            <td><?php echo $lang['basic']['phone']; ?></td>
            <td width="40%">Notas</td>
            <td>Parentesco</td>
        </tr>
        <?php echo GridReceivers(ListReceivers($_POST['BnfViewMode'], $_POST['RCTP'], $OBJCTCL, $OBJCTRC), $_POST['RCTP'], $OBJCTCL); ?>
        </table>
<?php echo ListReceiverDetails($MDRC, $OBJCTRC); ?>
</div>
</form>
<?php if ($CLST > 0) {
            die();
        } ?>
<div id="OrderProp"></div>